import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
//  路由表
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/')
    // 配置路由懒加载
  },
  {
    path: '/',
    component: () => import('@/views/layout/'),
    children: [
      {
        path: '', // 默认子路由有且只能有一个
        name: 'home',
        component: () => import('@/views/home/')
      },
      {
        path: '/qa',
        name: 'qa',
        component: () => import('@/views/qa/')
      },
      {
        path: '/video',
        name: 'video',
        component: () => import('@/views/video/')
      },
      {
        path: '/my',
        name: 'my',
        component: () => import('@/views/my/')
      },
      {
        path: '/search',
        name: 'search',
        component: () => import('@/views/search/')
      }
    ]
  }

]

const router = new VueRouter({
  routes
})

export default router
